/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sim_test;

import java.awt.image.BufferedImage;
import sim_test.Sim_ImageLoader;
import java.awt.Image;
import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 *
 * @author Administrator
 */
public class Sim_Gfx_Car {
    
    private Image facingN;
    private Image facingE;
    private Image facingS;
    private Image facingW;
    private Image currentImage;
    private Sim_ImageLoader imagePreloader;
    private int currentPosX = 0;
    private int currentPosY = 0;
    private int currentPosInGridX = 0;
    private int currentPosInGridY = 0;
    private int sizeOfTiles = 75;
    
    public Sim_Gfx_Car()
    {
        imagePreloader = new Sim_ImageLoader(75);
        loadAndSetImages();
    }
    
    private void loadAndSetImages()
    {
        Image[] images = imagePreloader.getCar1Images();
        facingE = images[0];
        facingN = images[1];
        facingS = images[2];
        facingW = images[3];
        currentImage = facingN;
    }
    
    public Image getCurrentImage()
    {
        return currentImage;
    }
    
    public ImageIcon getCurrentImageIcon()
    {
        return new ImageIcon(currentImage);
    }
    
    public void movedNorth()
    {
        currentImage = facingN;
        currentPosY -= sizeOfTiles;
        currentPosInGridY--;
    }
    
    public void movedEast()
    {
        currentImage = facingE;
        currentPosX += sizeOfTiles;
        currentPosInGridX++;
    }
    
    public void movedSouth()
    {
        currentImage = facingS;
        currentPosY += sizeOfTiles;
        currentPosInGridY++;
    }
    
    public void movedWest()
    {
        currentImage = facingW;
        currentPosX -= sizeOfTiles;
        currentPosInGridX--;
    }
    
    public int getPosX()
    {
        return currentPosX;
    }
    
    public int getPosY()
    {
        return currentPosY;
    }
    
    public int getPosInGridX()
    {
        return currentPosInGridX;
    }
    
    public int getPosInGridY()
    {
        return currentPosInGridY;
    }
    
    
    
}
